<% content_for :toolbar do %>
<div class="toolbar_buttons">
  <%= render 'alchemy/admin/partials/site_select' %>
  <%= render 'alchemy/admin/partials/language_tree_select' %>
  <% if can?(:flush, Alchemy::Page) %>
  <div class="button_with_label">
    <%= link_to(
      render_icon('flush'),
      alchemy.flush_admin_pages_path,
      :remote => true,
      :method => :post,
      :class => 'icon_button please_wait',
      :title => Alchemy.t('Flush page cache')
    ) %>
    <label><%= Alchemy.t('Flush page cache') %></label>
  </div>
  <% end %>
  <% if can?(:sort, Alchemy::Page) %>
  <div class="button_with_label" id="page_sorting_button">
    <%= link_to(
      render_icon('sort'),
      alchemy.sort_admin_pages_path,
      :complete => '',
      :method => :get,
      :remote => true,
      :class => 'icon_button please_wait',
      :title => Alchemy.t('Sort pages')
    ) %>
    <label><%= Alchemy.t('Sort pages') %></label>
  </div>
  <% end %>
  <div class="button_with_label" id="clipboard_button">
    <%= link_to_dialog(
      render_icon("clipboard#{clipboard_empty?('pages') ? '' : ' full'}"),
      alchemy.admin_clipboard_path(:remarkable_type => 'pages'),
      {
        :title => Alchemy.t('Clipboard'),
        :size => '380x305'
      },
      :class => 'icon_button',
      :title => Alchemy.t('Show clipboard')
    ) %>
    <label><%= Alchemy.t('Show clipboard') %></label>
  </div>
</div>
<div class="js_filter_field_box">
  <%= text_field_tag 'filter', '',
    class: 'thin_border js_filter_field search_input_field',
    placeholder: Alchemy.t(:search),
    id: nil %>
  <%= render_icon :search %>
  <%= link_to('', '#', {
    class: "js_filter_field_clear",
    title: Alchemy.t(:click_to_show_all)
  }) %>
</div>
<% end %>

<div id="archive_all">
<% if @page_root %>

  <div id="sort_panel" style="display: none">
    <div class="info">
      <%= render_icon('info') %>
      <%= Alchemy.t(:explain_sitemap_dragndrop_sorting) %>
    </div>
    <div class="buttons">
      <%= link_to( Alchemy.t(:cancel), alchemy.admin_pages_path, :class => 'button' ) %>&nbsp;
      <%= submit_tag( Alchemy.t('save order'), :id => 'save_page_order', :class => 'button' ) %>
    </div>
  </div>

  <h1 id="page_filter_result"></h1>

  <h2 id="sitemap_heading">
    <span class="page_name"><%= Alchemy.t('Name') %></span>
    <span class="page_infos"><%= Alchemy.t('Status') %></span>
  </h2>

  <%= render 'sitemap', page_partial: 'page', full: !!@sorting %>

<% elsif can?(:create, Alchemy::Page) %>

  <%= render partial: 'create_language_form' %>

<% else %>

  <%= render_message :warn do %>
    <h2>No language root page found.</h2>
    <p>Please ask the admin to create one.</p>
  <% end %>

<% end %>
</div>
